/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  							 script_random_number.h

	$Header: /heroes4/script_random_number.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( SCRIPT_RANDOM_NUMBER_H_INCLUDED )
#define SCRIPT_RANDOM_NUMBER_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "abstract_script_expression.h"
#include "script_expression_type.h"

// --------------------------------------------------------------------------
// t_script_random_number class
// --------------------------------------------------------------------------

class t_script_random_number : public t_abstract_script_numeric_expression
{
public:
	// Constructor
	t_script_random_number();

	// Member functions
	int					get_min_value() const;
	int					get_max_value() const;

	virtual bool		read( std::streambuf& stream, int version );
	virtual bool		read_from_map(
							std::streambuf &	stream,
							int					format_version );
	virtual bool		write( std::streambuf& stream ) const;

	virtual t_result	evaluate(t_expression_context_global const& context) const;

private:
	// Data members
	int					m_min_value;
	int					m_max_value;

	bool				read_values( std::streambuf& stream );
};

// --------------------------------------------------------------------------
// t_script_random_number inline members
// --------------------------------------------------------------------------

// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
inline t_script_random_number::t_script_random_number()
	:	m_min_value( 0 ),
		m_max_value( 0 )
{
}

// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
inline int t_script_random_number::get_min_value() const
{
	return m_min_value;
}

// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
inline int t_script_random_number::get_max_value() const
{
	return m_max_value;
}

SPECIALIZE_SCRIPT_NUMERIC_EXPRESSION( k_script_numeric_random, t_script_random_number );

#endif // !defined( SCRIPT_RANDOM_NUMBER_H_INCLUDED )
